
if exists(select name from sysobjects where name = 'sp_UserGetNguoiNhanGopYKien')
	drop proc sp_UserGetNguoiNhanGopYKien
go
/*
	Created by: Phuoc NH
	Created on: 13/05/2013 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_UserGetNguoiNhanGopYKien.sql
*/

create proc sp_UserGetNguoiNhanGopYKien
@NhomUserId int,
@MaKhoa varchar(50)
as
begin
	if(@NhomUserId=3)
		begin
			select * from nhomuser a inner join Users b on a.nhomuserid=b.NhomUserId and a.nhomuserid=@NhomUserId and b.Khoa=@makhoa
		end
	else if(@NhomUserId=2)
		begin
			select * from Users where NhomUserId=@NhomUserId
		end
end

